<extend name="Public/base"/>

<block name="body">
    <h3>配置管理</h3>
    <ul class="nav nav-tabs">
        <present name="Think.get.group"><li><a href="{:U('index')}">全部</a></li><else/><li class="active"><a href="{:U('index')}">全部</a></li></present>
        <foreach name="group" item="vo">
            <neq name="group_id" value="$key"><li><a href="{:U('index?group='.$key)}">{$vo}</a></li><else/><li class="active"><a href="{:U('index?group='.$key)}">{$vo}</a></li></neq>
        </foreach>
    </ul>
    <header class="header bg-white b-b clearfix">
        <div class="row m-t-sm">
            <div class="col-sm-8 m-b-xs">
                <a href="{:U('sort?group='.I('group'),'','')}" class="btn btn-sm btn-default"><i class="fa fa-arrows"></i> 排序</a>
                <a href="{:U('add')}" class="btn btn-sm btn-default"><i class="fa fa-plus"></i> 新增</a>
            </div>
            <div class="col-sm-4 m-b-xs">
                <div class="input-group">
                    <input type="text" name="name" id="searchname" class="input-sm form-control search-input" value="{:I('name')}" placeholder="请输入配置名称">
                    <span class="input-group-btn">
                        <button class="btn btn-sm btn-default" id="search" type="button"><i class="fa fa-search"></i></button>
                    </span>
                </div>
            </div>
        </div>
    </header>
    <div class="panel-body panel panel-default">
        <table class="table table-hover table-striped">
            <thead>
                <tr>
                    <!--<th class="row-selected">
                        <input class="checkbox check-all" type="checkbox">
                    </th>-->
                    <th>ID</th>
                    <th>名称</th>
                    <th>标题</th>
                    <th>分组</th>
                    <th>类型</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            <notempty name="list">
                <volist name="list" id="config">
                    <tr>
                        <!--<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$config.id}"></td>-->
                        <td>{$config.id}</td>
                        <td><a href="{:U('edit?id='.$config['id'])}">{$config.name}</a></td>
                        <td>{$config.title}</td>
                        <td>{$config.group|get_config_group}</td>
                        <td>{$config.type|get_config_type}</td>
                        <td>
                            <a href="{:U('edit?id='.$config['id'])}" title="编辑">编辑</a>
                            <a href="{:U('del?id='.$config['id'])}" class="confirm ajax-get" title="删除">删除</a>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
        <!-- 分页 -->
        <p class="page">{$_page}</p>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(function () {
            //搜索功能
            $("#search").click(function () {
                self.location = $.query.SET('name', $('#searchname').val());
            });
            //回车搜索
            $(".search-input").keyup(function (e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });
        });
    </script>
</block>